package com.fyh.feign;

import com.fyh.entity.common.Result;
import com.fyh.entity.job.DeliveryRecord;
import com.fyh.entity.job.JobPosition;
import com.fyh.entity.job.SimpleJobPosition;
import com.fyh.entity.user.SimpleCandidate;
import com.fyh.feign.fallback.EmployerJobFeignClientFallback;
import io.seata.spring.annotation.GlobalTransactional;
import org.apache.ibatis.annotations.Delete;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "service-job", fallback = EmployerJobFeignClientFallback.class, path = "/job")
public interface EmployerJobFeignClient {

    /**
     * 通过EmployerId获取职位列表
     *
     * @param employerId
     * @return
     */
    @GetMapping("/list")
    Result<List<SimpleJobPosition>> getSimpleJobListByEmployerId(@RequestParam("employerId") Long employerId);

    /**
     * 通过职位Id获取标签列表
     *
     * @param positionId
     * @return
     */
    @GetMapping("/tagListByPositionId")
    Result<List<String>> getTagNameListByPositionId(@RequestParam("positionId") Long positionId);

    /**
     * 通过职位Id获取职位详情
     *
     * @param positionId
     * @return
     */
    @GetMapping("/detail")
    Result<JobPosition> getJobPositionDetail(@RequestParam("positionId") Long positionId);


    /**
     * 更新职位信息
     *
     * @param jobPosition
     */
    @PostMapping("/update")
    Result updateJobPosition(@RequestBody JobPosition jobPosition);


    /**
     * 添加职位信息
     *
     * @param jobPosition
     */
    @PostMapping("/insert")
    Result addJobPosition(@RequestBody JobPosition jobPosition);

    /**
     * 删除职位信息
     *
     * @param positionId
     */
    @DeleteMapping("/deleteJobPosition")
    Result deleteJobPosition(@RequestParam("positionId") Long positionId);


    /**
     * 更新职位状态
     *
     * @param positionId
     * @param status
     */
    @PostMapping("/updateJobStatus/{positionId}")
    Result updateJobStatus(@RequestBody Integer status, @PathVariable("positionId") Long positionId);

    /**
     * 获取职位下所有求职者id，投递时间和投递状态
     *
     * @param positionId
     */
    @GetMapping("/getSimpleDeliveryRecordListList")
    Result<List<DeliveryRecord>> getSimpleDeliveryRecordListList(@RequestParam("positionId") Long positionId, @RequestParam("status") String status);

    /**
     * 更新职位求职者投递状态
     *
     * @param deliveryRecord
     */
    @PostMapping("/updateDeliveryStatus")
    Result updateDeliveryStatus(@RequestBody DeliveryRecord deliveryRecord);
}
